import Vue from 'vue'
import VueRouter from 'vue-router'
import Routers from './routers'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-default/index.css'
import App from './App.vue'
import Cookie from 'js-cookie'
Vue.use(ElementUI);
Vue.use(VueRouter);
const router = new VueRouter({
  mode: 'history',
  routes: Routers
})
router.beforeEach((to, from, next) => {
  if (Cookie.get("token") == undefined && to.path != "/login") {
    next({ path: "/login" });
  } else {
    next();
  }
   
});
new Vue({
  mode: 'history',
  router,
  // el: '#app',
  render: h => h(App)
}).$mount("#app")
